package com.rchat.pocmini.activity.bluetoothwalkie;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.aso.common.view.GridDivider;
import com.rchat.pocmini.R;
import com.rchat.pocmini.activity.bean.GroupBean;
import com.rchat.pocmini.activity.bluetoothwalkie.adapter.WalkieChannelAdapter;
import com.rchat.pocmini.activity.bluetoothwalkie.bean.WalkieChannelBean;
import com.rchat.pocmini.common.mvp.BaseMvpActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @Description ：蓝牙模拟对讲机写频功能
 * @Author itsdf07
 * @Time 2017/10/12
 */

public class WalkieChannelMvpActivity extends BaseMvpActivity<WalkieChannelPresenterImpl, WalkieChannelModeImpl> implements
        WalkieChannelContract.View,
        WalkieChannelAdapter.ItemTouchHelperAdapterCallback {

    private List<WalkieChannelBean> mChannelInfoList = new ArrayList<>();
    WalkieChannelAdapter mAdapter;

    /**
     * 远距离频道
     */
    @BindView(R.id.container_distance)
    RecyclerView mRVDistanceChannel;

    /**
     * 公众频道
     */
    @BindView(R.id.container_general)
    RecyclerView mRVGeneralChannel;

    @Override
    public void initPresenter() {

    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_walkiechannel;
    }

    @Override
    public void initView() {
        mRVDistanceChannel.setLayoutManager(new GridLayoutManager(this, 5));
        mRVDistanceChannel.addItemDecoration(new GridDivider(this, 1, this.getResources().getColor(R.color.color_999999), 5));
        mRVGeneralChannel.setLayoutManager(new GridLayoutManager(this, 5));
        mRVGeneralChannel.addItemDecoration(new GridDivider(this, 3, this.getResources().getColor(R.color.color_999999), 5));

        for (int i = 1; i <= 20; i++) {
            WalkieChannelBean bean = new WalkieChannelBean();
            bean.setChannelName(i + "");
            bean.setSelecting(false);
            mChannelInfoList.add(bean);
        }
    }

    @Override
    public void doAfterInitView() {

        mAdapter = new WalkieChannelAdapter(mChannelInfoList, this);
        mRVDistanceChannel.setAdapter(mAdapter);
        mRVGeneralChannel.setAdapter(mAdapter);
    }

    @Override
    public void onItemClick(View view, GroupBean bean) {

    }

    @OnClick({R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                doGoBack();
                break;
        }

    }
}
